package controller;

/**
 * Abstract class controller. All controller objects extend the Controller
 * abstract class, and as such, have access to the RMI stubs methods, the 
 * abstract Display methods, and the User methods.
 */

import gui.Display;
import model.user.User;
import server.networking.ServerRemoteInterface;

abstract public class Controller {
	/**
	 * The User object. Gives the controller access to methods used to modify the user.
	 */
	protected User user;
	
	/**
	 * The display object. Gives access to the current display and the methods available for to control the display.
	 */
	protected Display display;
	
	/**
	 * The RMI stub object. Allows the controller to call remote methods.
	 */
	protected ServerRemoteInterface serverRemote;
	
	/**
	 * Constructor method.
	 */
	public Controller() {}

	/**
	 * The giveControlTo method gives control from the current controller to the next controller based
	 * on the user's input and what Display is to be shown.
	 * @param c The new controller object.
	 */
	public void giveControlTo(Controller c) {
		c.user = this.user;
		c.serverRemote = this.serverRemote;
	}
	
	// Getters and setters
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public Display getDisplay() {
		return display;
	}
	
	public void setDisplay(Display d) {
		this.display = d;
	}

	public ServerRemoteInterface getServerRemote() {
		return serverRemote;
	}

	public void setServerRemote(ServerRemoteInterface serverRemote) {
		this.serverRemote = serverRemote;
	}

}
